package exp.day03;
//18.	某本书的页码从1开始，小明算了算，总共出现了202个数1，试编程求这本书一共有多少页？
public class P18 {
    public static void main(String[] args) {
        int ones = 0;
        int i = 1;
        for (; ones < 202; i++) {
            String s = "" + i;
            int total = 0;
            for (int j = 0; j < s.length(); j++) {
                if (s.charAt(j) == '1')
                    total++;
            }
            ones += total;
        }
        if (ones == 202 )
            System.out.println(i);
        else
            System.out.println("Error!");
    }
}